#include "menu.h" 
#include "u8g2.h"  
#include "bs_app.h"
#define LOG_TAG        "[menu]"
#include "log.h"

/*
结构体数组含义：
{当前索引，up，down，confirm，back，显示函数}
*/
key_table table[99]=
{

    {welcome,welcome,welcome,main_loading,welcome,(*fun_welcome)},

    /*主界面
    1，脱机烧录
    2，切换镜像
    3，系统设置
    4，
    */
    {main_listBox, 0, 0, 0, 0, NULL},
    {main_loading,main_memformat,main_switchFile, offlineLoading_fileDeatil,welcome,(*fun_main_loading)},
    {main_switchFile,main_loading,main_systemSettings, switchFile_returnMain,welcome,(*fun_main_switchFile)},
    {main_systemSettings,main_switchFile,main_memformat,common_view,welcome,(*fun_main_systemSettings)},		

    // {main_return,main_systemSettings,main_loading, welcome,welcome,(*fun_main_return)},//用于主界面返回，欢迎界面
    {main_memformat,main_systemSettings,main_loading, main_format_dialog,welcome,(*fun_main_memformat)},
    {main_format_dialog,0,0, 0,0,(*fun_format_dialog_show)},
    {main_format_proc,main_format_proc,main_format_proc, main_format_proc,main_format_proc,(*fun_format_dialog_proc)},

    /*脱机烧录
    5：文件信息
    6：切换文件
    7：系统设置
    8：返回
    */
    {offlineLoading_fileDeatil,offlineLoading_return,offlineLoading_switchFile,deatil,main_loading,(*fun_offlineLoading_fileDeatil)},					
    {offlineLoading_switchFile,offlineLoading_fileDeatil,offlineLoading_systemSettings,switchFile_returnMain,main_loading,(*fun_offlineLoading_switchFile)},
    {offlineLoading_systemSettings,offlineLoading_switchFile,offlineLoading_return,common_view,main_loading,(*fun_offlineLoading_systemSettings)},						                	
    {offlineLoading_return,offlineLoading_systemSettings,offlineLoading_fileDeatil, main_loading,main_loading,(*fun_offlineLoading_return)},

    /*切换镜像
    10：返回上一级
    列表控件，记录着返回地址
    11……每个文件
        cur  |   up    |    down    |    enter    |    back
    */

    {switchFile_returnMain,switchFile_up,switchFile_down,main_switchFile,main_switchFile,(*fun_switchFile_returnMain)},					

    {switchFile_Listbox, 0, 0, 0, 0, fun_switchFile_ListFile},

    {switchFile_up,  switchFile_up, switchFile_down, switchFile_select, main_switchFile,(*fun_switchFile_up)},
    {switchFile_down,switchFile_up, switchFile_down, switchFile_select, main_switchFile,(*fun_switchFile_down)},

    // 文件操作界面
    {switchFile_select,   selectFile_msg_up, selectFile_msg_down,selectFile_msg_enter,selectFile_msg_close,(*fun_selectFile_msg_show)},
    {selectFile_msg_up,   selectFile_msg_up, selectFile_msg_down,selectFile_msg_enter,selectFile_msg_close,(*fun_selectFile_msg_up)},
    {selectFile_msg_down, selectFile_msg_up, selectFile_msg_down,selectFile_msg_enter,selectFile_msg_close,(*fun_selectFile_msg_down)},
    {selectFile_msg_enter, 0, 0,0, 0, (*fun_selectFile_msg_enter)},
    {selectFile_msg_close, 0, 0, 0, 0, (*fun_selectFile_msg_close)},

	
    /*系统设置：
    13：烧录模式
    14：烧录速度
    15：设备信息
    16：返回
    */
    {common_view,systemSetting_return,loading_followSpeed_view,common_select_common,main_systemSettings,(*fun_common_view)},		//普通烧录模式的设置概览			

    {loading_followSpeed_view,common_view,device_view,loading_followSpeed_select_follow,main_systemSettings,(*fun_loading_followSpeed_view)},	//跟随镜像文件烧录速度		

    {device_view,loading_followSpeed_view,systemSetting_return,device_view,main_systemSettings,(*fun_device_view)},				                	
    {systemSetting_return,device_view,common_view, main_systemSettings,main_systemSettings,(*fun_systemSetting_return)},


    {deatil,deatil,deatil,offlineLoading_fileDeatil,offlineLoading_systemSettings,(*fun_deatil)},	//文件信息		                	


    {common_select_common,common_select_return,common_select_power,common_select_common,offlineLoading_systemSettings,(*fun_common_select_common)},		//普通烧录模式的模式选择 ：普通模式              	
    {common_select_power,common_select_common,common_select_return,power_select_power,offlineLoading_systemSettings,(*fun_common_select_power)},		//普通烧录模式的模式选择：电源模式
    {common_select_return,common_select_power,common_select_common, common_view,NULL,(*fun_common_select_return)},	//普通烧录模式的模式选择：返回		                	
        

    {power_view,systemSetting_return,loading_followSpeed_view,power_select_common,main_systemSettings,(*fun_power_view)},	//电源烧录模式设置概览		                	

    {power_select_common,power_select_return,power_select_power,common_select_common,NULL,(*fun_power_select_common)},//电源烧录模式的模式选择：普通模式
    {power_select_power,power_select_common,power_select_return,power_select_power,device_view,(*fun_power_select_power)},//电源烧录模式的模式选择：电源模式			                	
    {power_select_return,power_select_power,power_select_common,power_view,device_view,(*fun_power_select_return)},//电源烧录模式的模式选择：返回


    {loading_followSpeed_select_follow,loading_followSpeed_select_return,loading_followSpeed_select_high,loading_followSpeed_select_follow,device_view,(*fun_loading_followSpeed_select_follow)},//跟随镜像文件烧录速度选择界面
    {loading_followSpeed_select_high,loading_followSpeed_select_follow,loading_followSpeed_select_medi,loading_highSpeed_select_high,device_view,(*fun_loading_followSpeed_select_high)},
    {loading_followSpeed_select_medi,loading_followSpeed_select_high,loading_followSpeed_select_low,loading_mediSpeed_select_medi,device_view,(*fun_loading_followSpeed_select_medi)},
    {loading_followSpeed_select_low,loading_followSpeed_select_medi,loading_followSpeed_select_return,loading_lowSpeed_select_low,device_view,(*fun_loading_followSpeed_select_low)},
    {loading_followSpeed_select_return,loading_followSpeed_select_low,loading_followSpeed_select_follow,loading_followSpeed_view,device_view,(*fun_loading_followSpeed_select_return)},


    {loading_highSpeed_view,common_view,device_view,loading_highSpeed_select_follow,main_systemSettings,(*fun_loading_highSpeed_view)},	//高烧录速度

    {loading_highSpeed_select_follow,loading_highSpeed_select_return,loading_highSpeed_select_high,loading_followSpeed_select_follow,device_view,(*fun_loading_highSpeed_select_follow)},//跟随高烧录速度选择界面
    {loading_highSpeed_select_high,loading_highSpeed_select_follow,loading_highSpeed_select_medi,loading_highSpeed_select_high,device_view,(*fun_loading_highSpeed_select_high)},
    {loading_highSpeed_select_medi,loading_highSpeed_select_high,loading_highSpeed_select_low,loading_mediSpeed_select_medi,device_view,(*fun_loading_highSpeed_select_medi)},
    {loading_highSpeed_select_low,loading_highSpeed_select_medi,loading_highSpeed_select_return,loading_lowSpeed_select_low,device_view,(*fun_loading_highSpeed_select_low)},
    {loading_highSpeed_select_return,loading_highSpeed_select_low,loading_highSpeed_select_follow,loading_highSpeed_view,device_view,(*fun_loading_highSpeed_select_return)},

    {loading_mediSpeed_view,common_view,device_view,loading_mediSpeed_select_follow,main_systemSettings,(*fun_loading_mediSpeed_view)},	//中烧录速度

    {loading_mediSpeed_select_follow,loading_mediSpeed_select_return,loading_mediSpeed_select_high,loading_followSpeed_select_follow,device_view,(*fun_loading_mediSpeed_select_follow)},//跟随中烧录速度选择界面
    {loading_mediSpeed_select_high,loading_mediSpeed_select_follow,loading_mediSpeed_select_medi,loading_highSpeed_select_high,device_view,(*fun_loading_mediSpeed_select_high)},
    {loading_mediSpeed_select_medi,loading_mediSpeed_select_high,loading_mediSpeed_select_low,loading_mediSpeed_select_medi,device_view,(*fun_loading_mediSpeed_select_medi)},
    {loading_mediSpeed_select_low,loading_mediSpeed_select_medi,loading_mediSpeed_select_return,loading_lowSpeed_select_low,device_view,(*fun_loading_mediSpeed_select_low)},
    {loading_mediSpeed_select_return,loading_mediSpeed_select_low,loading_mediSpeed_select_follow,loading_mediSpeed_view,device_view,(*fun_loading_mediSpeed_select_return)},

    {loading_lowSpeed_view,common_view,device_view,loading_lowSpeed_select_follow,main_systemSettings,(*fun_loading_lowSpeed_view)},	//低烧录速度

    {loading_lowSpeed_select_follow,loading_lowSpeed_select_return,loading_lowSpeed_select_high,loading_followSpeed_select_follow,device_view,(*fun_loading_lowSpeed_select_follow)},//跟随低烧录速度选择界面
    {loading_lowSpeed_select_high,loading_lowSpeed_select_follow,loading_lowSpeed_select_medi,loading_highSpeed_select_high,device_view,(*fun_loading_lowSpeed_select_high)},
    {loading_lowSpeed_select_medi,loading_lowSpeed_select_high,loading_lowSpeed_select_low,loading_mediSpeed_select_medi,device_view,(*fun_loading_lowSpeed_select_medi)},
    {loading_lowSpeed_select_low,loading_lowSpeed_select_medi,loading_lowSpeed_select_return,loading_lowSpeed_select_low,device_view,(*fun_loading_lowSpeed_select_low)},
    {loading_lowSpeed_select_return,loading_lowSpeed_select_low,loading_lowSpeed_select_follow,loading_lowSpeed_view,device_view,(*fun_loading_lowSpeed_select_return)},




};


static char tmp_buf[128];
uint32_t item_list;
uint32_t item_max;
uint32_t current;
uint32_t parent;
extern uint32_t key_msg;
extern uchar func_index;


void fun_main_listItems()
{
    u8g2_DrawUTF8(u8g2,0,16*(item_list+1),">");
    u8g2_DrawUTF8(u8g2,16,16,"脱机烧录");
    u8g2_DrawUTF8(u8g2,16,32,"镜像更换");
    u8g2_DrawUTF8(u8g2,16,48,"系统设置");
    u8g2_DrawUTF8(u8g2,16,64,"格式化");
}


void fun_main_loading()   
{	
    item_list = 0;
    item_max = 4-1;
    fun_main_listItems();
}


void fun_main_switchFile()   
{	
    item_list = 1;
    fun_main_listItems();																					
}


void fun_main_systemSettings()     
{
    item_list = 2;
    fun_main_listItems();																				
}


void fun_main_memformat()     
{
    item_list = 3;
    fun_main_listItems();																					
}


void fun_format_dialog_listItems()
{
    u8g2_DrawUTF8(u8g2,0,16*(item_list+1),">");
    u8g2_DrawUTF8(u8g2,16,16,"返回");
    u8g2_DrawUTF8(u8g2,16,32,"确认");
}


void fun_format_dialog_show()
{
    table[main_listBox].enter = item_list;
    table[main_listBox].up = item_max;

    item_list = 0;
    item_max = 1;
    fun_format_dialog_listItems();
    func_index = main_format_proc;
}

void fun_format_dialog_close()
{
    item_list = table[main_listBox].enter;
    item_max = table[main_listBox].up;
    fun_main_memformat();
    func_index = main_memformat;
}


void fun_format_dialog_proc()
{
    switch (key_msg) {
        case MSG_KEYUP:
            if (item_list == 0) item_list = item_max;
            else item_list--;
            fun_format_dialog_listItems();
        break;

        case MSG_KEYDOWN:
            if (item_list == item_max) item_list = 0;
            else item_list++;
            fun_format_dialog_listItems();
        break;

        case MSG_KEY_ENTER:
            LOGI("key enter");
            if (item_list == 1) {
                f_mkfs(0);
                bs_imgr_region_clear();
            }
            fun_format_dialog_close();
        break;

        case MSG_KLONGPRESS:
            fun_format_dialog_close();
        break;

        default:
        break;
    }

}


void fun_main_return()     
{	
	u8g2_DrawUTF8(u8g2,0,64,">");
	u8g2_DrawUTF8(u8g2,16,16,"脱机烧录");
	u8g2_DrawUTF8(u8g2,16,32,"镜像更换");
	u8g2_DrawUTF8(u8g2,16,48,"系统设置");
	u8g2_DrawUTF8(u8g2,16,64,"返回");																						
}

extern void ice_download_start(void);

extern bs_images_mgr_t    hImage;
extern wear_level_flash_t  img_burn_info;


//脱机烧录界面，数组序号5，6，7，8
void fun_offlineLoading_fileDeatil()
{
	// 这里直接烧录
    bs_image_node_t *cur_img;
    wear_level_flash_t  *burn_info = &img_burn_info;
    cur_img = &hImage.images[hImage.i_active];

    ice_download_start();

    sprintf(tmp_buf, "镜像概览：%s", cur_img->file_name);
    u8g2_DrawUTF8(u8g2,0,20,tmp_buf);

    u8g2_DrawUTF8(u8g2,0,80,"数据统计");
    u8g2_DrawUTF8(u8g2,100,80,"总共次数");
    u8g2_DrawUTF8(u8g2,160,80,"已烧录");
    u8g2_DrawUTF8(u8g2,220,80,"剩余次数");


    sprintf(tmp_buf, "%d", cur_img->limit);
    u8g2_DrawUTF8(u8g2,100,100,tmp_buf);
    
    sprintf(tmp_buf, "%d", burn_info->u.data.used_count);
    u8g2_DrawUTF8(u8g2,160,100,tmp_buf);

    sprintf(tmp_buf, "%d", cur_img->limit - burn_info->u.data.used_count);
    u8g2_DrawUTF8(u8g2,220,100,tmp_buf);

    u8g2_DrawUTF8(u8g2,0,120,"当前烧录：");
    u8g2_DrawUTF8(u8g2,150,120,"烧录模式：");

    u8g2_DrawFrame(u8g2,0,125,243,114);


    u8g2_DrawUTF8(u8g2,254,165,">");
    u8g2_DrawUTF8(u8g2,270,165,"文件信息");
    u8g2_DrawUTF8(u8g2,270,181,"切换文件");
    u8g2_DrawUTF8(u8g2,270,197,"系统设置");
    u8g2_DrawUTF8(u8g2,270,213,"返回");

}

void fun_offlineLoading_switchFile()      
{	
    u8g2_DrawUTF8(u8g2,0,20,"镜像概览：");
    u8g2_DrawUTF8(u8g2,0,80,"数据统计");
    u8g2_DrawUTF8(u8g2,100,80,"总共次数");
    u8g2_DrawUTF8(u8g2,160,80,"已烧录");
    u8g2_DrawUTF8(u8g2,220,80,"剩余次数");

    u8g2_DrawUTF8(u8g2,100,100,"----");
    u8g2_DrawUTF8(u8g2,160,100,"----");
    u8g2_DrawUTF8(u8g2,220,100,"----");

    u8g2_DrawUTF8(u8g2,0,120,"当前烧录：");
    u8g2_DrawUTF8(u8g2,150,120,"烧录模式：");

    u8g2_DrawFrame(u8g2,0,125,243,114);



    u8g2_DrawUTF8(u8g2,254,181,">");
    u8g2_DrawUTF8(u8g2,270,165,"文件信息");
    u8g2_DrawUTF8(u8g2,270,181,"切换文件");
    u8g2_DrawUTF8(u8g2,270,197,"系统设置");
    u8g2_DrawUTF8(u8g2,270,213,"返回");																						
}

void fun_offlineLoading_systemSettings()    
{	
    u8g2_DrawUTF8(u8g2,0,20,"镜像概览：");
	u8g2_DrawUTF8(u8g2,0,80,"数据统计");
	u8g2_DrawUTF8(u8g2,100,80,"总共次数");
	u8g2_DrawUTF8(u8g2,160,80,"已烧录");
	u8g2_DrawUTF8(u8g2,220,80,"剩余次数");
	
	u8g2_DrawUTF8(u8g2,100,100,"----");
	u8g2_DrawUTF8(u8g2,160,100,"----");
	u8g2_DrawUTF8(u8g2,220,100,"----");

	u8g2_DrawUTF8(u8g2,0,120,"当前烧录：");
	u8g2_DrawUTF8(u8g2,150,120,"烧录模式：");

	u8g2_DrawFrame(u8g2,0,125,243,114);



	u8g2_DrawUTF8(u8g2,254,197,">");
	u8g2_DrawUTF8(u8g2,270,165,"文件信息");
	u8g2_DrawUTF8(u8g2,270,181,"切换文件");
	u8g2_DrawUTF8(u8g2,270,197,"系统设置");
	u8g2_DrawUTF8(u8g2,270,213,"返回");																						
}

void fun_offlineLoading_return()    
{	
	u8g2_DrawUTF8(u8g2,0,20,"镜像概览：");
	u8g2_DrawUTF8(u8g2,0,80,"数据统计");
	u8g2_DrawUTF8(u8g2,100,80,"总共次数");
	u8g2_DrawUTF8(u8g2,160,80,"已烧录");
	u8g2_DrawUTF8(u8g2,220,80,"剩余次数");
	
	u8g2_DrawUTF8(u8g2,100,100,"----");
	u8g2_DrawUTF8(u8g2,160,100,"----");
	u8g2_DrawUTF8(u8g2,220,100,"----");

	u8g2_DrawUTF8(u8g2,0,120,"当前烧录：");
	u8g2_DrawUTF8(u8g2,150,120,"烧录模式：");

	u8g2_DrawFrame(u8g2,0,125,243,114);



	u8g2_DrawUTF8(u8g2,254,213,">");
	u8g2_DrawUTF8(u8g2,270,165,"文件信息");
	u8g2_DrawUTF8(u8g2,270,181,"切换文件");
	u8g2_DrawUTF8(u8g2,270,197,"系统设置");
	u8g2_DrawUTF8(u8g2,270,213,"返回");																							
}


// 当前什么动作（功能），需要展示什么页面？
// 当前的菜单项需要把所有页面都画完，它不能只画自己的，返回之后咋办？
// 应该有一个菜单项保存着它的历史足迹，那么下一次返回也能找到
// 第几个菜单，但是可能某些子菜单的足迹并不一样



void fun_switchFile_listitems()
{
    uint32_t x,y;
    (void)x;
    (void)y;

    bs_timespec_t *tim_info;
    if (item_list == 0) {
        func_index = switchFile_returnMain;
    }
    u8g2_DrawUTF8(u8g2,0,16*(item_list+1),">");
    u8g2_DrawUTF8(u8g2,16,16,"返回上一级");
    for (int i=0; i<hImage.images_num; i++) {
        u8g2_DrawUTF8(u8g2,16,32+i*16, hImage.images[i].file_name);
        tim_info = &hImage.images[i].download_time;
        //printf("Current date: %0.2x.%0.2x.%0.2x\n\r",rtc_initpara.year, rtc_initpara.month, rtc_initpara.date);
        sprintf(tmp_buf, "%x/%x/%x %x:%x", tim_info->tm_year, tim_info->tm_mon, tim_info->tm_day, tim_info->tm_hour, tim_info->tm_min);
        u8g2_DrawUTF8(u8g2,16+96,32+i*16, tmp_buf);
        
        sprintf(tmp_buf, "%d B",  hImage.images[i].encrypted_file_len);
        u8g2_DrawUTF8(u8g2,16+96+96,32+i*16, tmp_buf);
        
        sprintf(tmp_buf, "0x%04x",  hImage.images[i].used_count);
        u8g2_DrawUTF8(u8g2,16+96+96+64,32+i*16, tmp_buf);
    }
}


// label：返回
void fun_switchFile_returnMain()    
{
    item_list = 0;
    item_max = hImage.images_num+1-1;
    fun_switchFile_listitems();
    current = table[switchFile_returnMain].current;
}



void fun_switchFile_ListFile()    
{	
    item_list = 1;
    fun_switchFile_listitems();
}


// up
void fun_switchFile_up()    
{	
    // 怎么知道当前是第几项？
    if (item_list==0) item_list = item_max;
    else
        item_list--;
    fun_switchFile_listitems();
}


void fun_switchFile_down()    
{	
    if (item_list==item_max) item_list = 0;
    else
        item_list++;
    fun_switchFile_listitems();
}


/*!
    \brief      文件对话框：return OK cancel
    \param[in]  none
    \param[out] none
    \retval     none
*/
void fun_selectFile_listItems()
{
    u8g2_DrawUTF8(u8g2,0,16*(item_list+1),">");
    u8g2_DrawUTF8(u8g2,16,16,"返回");
    u8g2_DrawUTF8(u8g2,16,32,"激活");
    u8g2_DrawUTF8(u8g2,16,48,"删除");
}



/*!
    \brief      弹出对话框
    \param[in]  none
    \param[out] none
    \retval     none
*/
void fun_selectFile_msg_show()
{
    // 先保存索引，下一次要返回
    table[switchFile_Listbox].enter = item_list;
    parent = item_list;
    item_list = 0;
    fun_selectFile_listItems();

    LOGI("The %dth file is currently selected", parent-1);
}


void fun_selectFile_msg_up()
{	
    // 怎么知道当前是第几项？
    if (item_list==0) item_list = 2;
    else
        item_list--;
    fun_selectFile_listItems();
}


void fun_selectFile_msg_down()
{	
    if (item_list==2) item_list = 0;
    else
        item_list++;
    fun_selectFile_listItems();
}


/*!
    \brief      文件对话框：选中按钮
    \param[in]  none
    \param[out] none
    \retval     none
*/
void fun_selectFile_msg_enter()
{	
    switch (item_list) {
        case 0:
            LOGI("msgBox select 'return'");
        break;

        case 1:
            LOGI("msgBox select 'active'");
            bs_imgr_select_image(parent - 1);
        break;

        case 2:
            LOGI("msgBox select 'delete'");
            bs_imgr_del_image(parent - 1);
            fun_switchFile_returnMain();
            func_index = switchFile_returnMain;
            return;
    
        default:
        break;
    }
    

    item_list = parent;
    fun_switchFile_listitems();
    // 将当前窗口指针，指向父窗口
    func_index = switchFile_up;
}


/*!
    \brief      取消对话框，返回上一层
    \param[in]  none
    \param[out] none
    \retval     none
*/
void fun_selectFile_msg_close()
{
    // 恢复之前的索引
    LOGI("msgBox cancel");
    item_list = parent;
    fun_switchFile_listitems();
    // 将当前窗口指针，指向父窗口
    func_index = switchFile_up;
}





void fun_common_view()    
{	
	u8g2_DrawUTF8(u8g2,0,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,106,48,"返回");


}

void fun_loading_followSpeed_view()    
{	
	u8g2_DrawUTF8(u8g2,0,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");

	

}

void fun_device_view()    
{	
	u8g2_DrawUTF8(u8g2,0,48,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"设备型号：");
	u8g2_DrawUTF8(u8g2,122,32,"硬件版本：");
	u8g2_DrawUTF8(u8g2,122,48,"boot版本：");
	u8g2_DrawUTF8(u8g2,122,64,"固件版本：");
	u8g2_DrawUTF8(u8g2,122,80,"产品序列号：");


	u8g2_DrawUTF8(u8g2,200,16,"----");
	u8g2_DrawUTF8(u8g2,200,32,"----");
	u8g2_DrawUTF8(u8g2,200,48,"----");
	u8g2_DrawUTF8(u8g2,200,64,"----");
	u8g2_DrawUTF8(u8g2,200,80,"----");


}

void fun_systemSetting_return()    
{	
	u8g2_DrawUTF8(u8g2,0,64,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");																				
}


void fun_deatil()    
{	
	u8g2_DrawUTF8(u8g2,0,16,"文件信息");
	u8g2_DrawUTF8(u8g2,0,64,"Enter to Return");																						
}

void fun_common_select_common()    
{	
	u8g2_DrawUTF8(u8g2,90,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,106,48,"返回");																					
}


void fun_common_select_power()    
{	
	u8g2_DrawUTF8(u8g2,90,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,106,48,"返回");																					
}

void fun_common_select_return()    
{	
	u8g2_DrawUTF8(u8g2,90,48,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,106,48,"返回");	

	//修改设置烧录模式预览图：普通模式
	//修改有脱机烧录模式进入系统设置的预览图：普通模式
	table[main_systemSettings].enter=common_view;
	table[offlineLoading_systemSettings].enter=common_view;
	//修改系统设置上下按钮显示
	table[loading_followSpeed_view].up=common_view;//跟随烧录速度
	table[systemSetting_return].down=common_view;
	
	table[loading_highSpeed_view].up=common_view;//高速烧录
	table[systemSetting_return].down=common_view;

	table[loading_mediSpeed_view].up=common_view;//中速烧录
	table[systemSetting_return].down=common_view;

	table[loading_lowSpeed_view].up=common_view;//低速烧录
	table[systemSetting_return].down=common_view;


}

void fun_power_view()    
{	
	u8g2_DrawUTF8(u8g2,0,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,106,48,"返回");																						
}

void fun_power_select_common()    
{	
	u8g2_DrawUTF8(u8g2,90,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,106,48,"返回");																							
}

void fun_power_select_power()    
{	
	u8g2_DrawUTF8(u8g2,90,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,106,48,"返回");																						
}

void fun_power_select_return()    
{	
	u8g2_DrawUTF8(u8g2,90,48,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"普通烧录");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"电源烧录");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,106,48,"返回");	
	//修改设置烧录模式预览图：电源烧录模式
	//修改有脱机烧录模式进入系统设置的预览图：电源烧录模式
	table[main_systemSettings].enter=power_view;
	table[offlineLoading_systemSettings].enter=power_view;
	//修改系统设置上下按钮显示
	table[loading_followSpeed_view].up=power_view;//跟随烧录速度
	table[systemSetting_return].down=power_view;
	
	table[loading_highSpeed_view].up=power_view;//高速烧录
	table[systemSetting_return].down=power_view;

	table[loading_mediSpeed_view].up=power_view;//中速烧录
	table[systemSetting_return].down=power_view;

	table[loading_lowSpeed_view].up=power_view;//低速烧录
	table[systemSetting_return].down=power_view;


}

void fun_loading_followSpeed_select_follow()    
{	
	u8g2_DrawUTF8(u8g2,90,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");

	
																				
}

void fun_loading_followSpeed_select_high(){
	u8g2_DrawUTF8(u8g2,90,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	


}

void fun_loading_followSpeed_select_medi(){
	u8g2_DrawUTF8(u8g2,90,48,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	


}


void fun_loading_followSpeed_select_low(){
	u8g2_DrawUTF8(u8g2,90,64,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	



}


void fun_loading_followSpeed_select_return(){
	u8g2_DrawUTF8(u8g2,90,80,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25ce);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	

	//修改上下按钮显示
	table[common_view].down=loading_followSpeed_view;
	table[power_view].down=loading_followSpeed_view;
	table[device_view].up=loading_followSpeed_view;

}


void fun_loading_highSpeed_view(){
	u8g2_DrawUTF8(u8g2,0,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");


}

void fun_loading_highSpeed_select_follow(){
	u8g2_DrawUTF8(u8g2,90,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}
void fun_loading_highSpeed_select_high(){
	u8g2_DrawUTF8(u8g2,90,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	
	
}
void fun_loading_highSpeed_select_medi(){
	u8g2_DrawUTF8(u8g2,90,48,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	
}
void fun_loading_highSpeed_select_low(){
	u8g2_DrawUTF8(u8g2,90,64,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}
void fun_loading_highSpeed_select_return(){
	u8g2_DrawUTF8(u8g2,90,80,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25ce);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");

	
	//修改上下按钮显示
	table[common_view].down=loading_highSpeed_view;
	table[power_view].down=loading_highSpeed_view;
	table[device_view].up=loading_highSpeed_view;
}









void fun_loading_mediSpeed_view(){
	u8g2_DrawUTF8(u8g2,0,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25ce);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");


}

void fun_loading_mediSpeed_select_follow(){
	u8g2_DrawUTF8(u8g2,90,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25ce);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}
void fun_loading_mediSpeed_select_high(){
	u8g2_DrawUTF8(u8g2,90,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25ce);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	
	
}
void fun_loading_mediSpeed_select_medi(){
	u8g2_DrawUTF8(u8g2,90,48,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25ce);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");	
}
void fun_loading_mediSpeed_select_low(){
	u8g2_DrawUTF8(u8g2,90,64,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25ce);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}
void fun_loading_mediSpeed_select_return(){
	u8g2_DrawUTF8(u8g2,90,80,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25ce);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25cb);
	u8g2_DrawUTF8(u8g2,106,80,"返回");

	
	//修改上下按钮显示
	table[common_view].down=loading_mediSpeed_view;
	table[power_view].down=loading_mediSpeed_view;
	table[device_view].up=loading_mediSpeed_view;

}



void fun_loading_lowSpeed_view(){
	u8g2_DrawUTF8(u8g2,0,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25ce);
	u8g2_DrawUTF8(u8g2,106,80,"返回");

}

void fun_loading_lowSpeed_select_follow(){
	u8g2_DrawUTF8(u8g2,90,16,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25ce);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}
void fun_loading_lowSpeed_select_high(){
	u8g2_DrawUTF8(u8g2,90,32,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25ce);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}
void fun_loading_lowSpeed_select_medi(){
	u8g2_DrawUTF8(u8g2,90,48,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25ce);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}

void fun_loading_lowSpeed_select_low(){
	u8g2_DrawUTF8(u8g2,90,64,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25ce);
	u8g2_DrawUTF8(u8g2,106,80,"返回");
}

void fun_loading_lowSpeed_select_return(){
	u8g2_DrawUTF8(u8g2,90,80,">");
	u8g2_DrawUTF8(u8g2,16,16,"烧录模式");
	u8g2_DrawUTF8(u8g2,16,32,"烧录速度");
	u8g2_DrawUTF8(u8g2,16,48,"设备信息");
	u8g2_DrawUTF8(u8g2,16,64,"返回");	

	u8g2_DrawLine(u8g2,80,0,80,239);

	u8g2_DrawUTF8(u8g2,122,16,"跟随镜像文件");
	u8g2_DrawGlyph(u8g2,106,16,0x25cb);
	u8g2_DrawUTF8(u8g2,122,32,"高速");
	u8g2_DrawGlyph(u8g2,106,32,0x25cb);
	u8g2_DrawUTF8(u8g2,122,48,"中速");
	u8g2_DrawGlyph(u8g2,106,48,0x25cb);
	u8g2_DrawUTF8(u8g2,122,64,"低速");
	u8g2_DrawGlyph(u8g2,106,64,0x25ce);
	u8g2_DrawUTF8(u8g2,106,80,"返回");

	//修改上下按钮显示
	table[common_view].down=loading_lowSpeed_view;
	table[power_view].down=loading_lowSpeed_view;
	table[device_view].up=loading_lowSpeed_view;
}







void fun_welcome()
{
	u8g2_DrawUTF8(u8g2,0,32,"Multi Menu Test");
	u8g2_DrawUTF8(u8g2,0,48,"");
	u8g2_DrawUTF8(u8g2,0,64,"Enter to Test");

	u8g2_DrawUTF8(u8g2,20,80,"固件信息");
	u8g2_DrawGlyph(u8g2,0,80,0x25cb);//空心圆

	u8g2_DrawUTF8(u8g2,20,96,"固件信息");
	u8g2_DrawGlyph(u8g2,0,96,0x25ce);//实心圆
}
